﻿namespace MetaVideoEditorEvolved.Converter
{
	using System.Collections.ObjectModel;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows.Data;

    public class GenresCollectionConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var genres = value as ObservableCollection<string>;

            if (genres == null)
            {
                return string.Empty;
            }

            var genresStr = string.Empty;

            foreach (var genre in genres)
            {
                genresStr += genre + " - ";
            }

            if (genres.Count == 0)
            {
                return "Genre indéterminé";
            }

            return genresStr.Substring(0, genresStr.Length - 3);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
